import request from '@/utils/request'
import { ILogin } from './types/common'

export const getCaptcha = () => {
  return request<Blob>({
    method: 'GET',
    url: '/captcha_pro',
    params: {
      stamp: Date.now()// 每次param都不一样，防止被缓存
    },
    responseType: 'blob' // 二进制数据非json
  })
}

export const loginIn = (data:{
  account:string
  pwd:string
  imgcode:string
}) => {
  return request<ILogin>({
    method: 'POST',
    url: '/login',
    data
  })
}

export const logout = () => {
  return request({
    method: 'GET',
    url: '/setting/admin/logout'
  })
}
